package models

import (
	"time"

	. "gddgame.cc/galaxy/common/dsl/db"
	"gddgame.cc/galaxy/utils/orm"
)

var (
	UserFriendModel = orm.NewModel("user_friend", &UserFriend{}, nil)
)

func init() {
	AddTable(&Table{
		Model: UserFriendModel,
	})
}

type FriendStatus byte

const (
	InvitedStatus FriendStatus = iota
	ConfirmStatus
	CancelStatus
)

// 用户按app获取到不同的open信息
// 用于区分不同app中用户的昵称和进行登录凭证的判断
type UserFriend struct {
	Id         int          `json:"id" orm:"auto" sql:"INT"`
	UserId     int          `json:"user_id" sql:"INT"`
	AppId      int          `json:"app_id" sql:"INT"`
	FriendId   int          `json:"friend_id" sql:"INT"`
	Status     FriendStatus `json:"status" sql:"TINYINT"`
	UpdateTime *time.Time   `json:"update_time" orm:"updateTime" sql:"dateTime"`
}
